package com.example.ojcommon.enums;

import lombok.Getter;

@Getter
public enum CompetitionEnum {

    NOT_STARTED("未开始", 1),
    PROGRESS("正在进行", 2),
    OVER("已结束", 3);

    private final String text;

    private final Integer value;

    CompetitionEnum(String text, Integer value) {
        this.text = text;
        this.value = value;
    }

    public static CompetitionEnum valueOf(Integer value) {
        if (value == null) {
            return null;
        }
        for (CompetitionEnum competitionEnum : CompetitionEnum.values()) {
            if (competitionEnum.getValue().equals(value)) {
                return competitionEnum;
            }
        }
        return null;
    }
}
